fix(loop): improve validation for greenfield builds#177
fix(loop): improve validation for greenfield builds#177rubenmarcus wants to merge 1 commit intomainfrom
Conversation
- Reset circuit breaker when tasks advance (prevents false positives during multi-task greenfield builds where early tasks can't pass tests) - Add package manager detection: auto-detect pnpm/yarn/bun from lockfiles and packageManager field instead of hardcoding npm - Add validation warm-up: skip validation until enough tasks are done for greenfield builds (auto-detected, configurable via --validation-warmup) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Issue Linking ReminderThis PR doesn't appear to have a linked issue. Consider linking to:
Using If this PR doesn't need an issue, you can ignore this message. |
✔️ Bundle Size Analysis
Bundle breakdown |
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 7aea4a25c1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (script === 'test') { | ||
| return { command: pm, args: ['test'] }; | ||
| } |
There was a problem hiding this comment.
Use
bun run for Bun test scripts
getRunCommand maps every test script to <pm> test, but for Bun that command invokes Bun’s built-in test runner, not the package.json script (bun --help describes test as “Run unit tests with Bun” while bun run <script> is for package scripts). In Bun projects that define scripts.test (for example vitest), validation and generated commands will run the wrong command and can report misleading pass/fail results.
Useful? React with 👍 / 👎.
|
|
||
| // Auto-detect greenfield builds: skip validation until enough tasks are done | ||
| const isGreenfield = taskCount.total > 0 && taskCount.completed === 0; | ||
| const autoWarmup = isGreenfield ? Math.max(2, Math.floor(taskCount.total * 0.5)) : 0; |
There was a problem hiding this comment.
Prevent warm-up from skipping all validation on small plans
The auto warm-up floor of 2 means a one-task plan gets validationWarmup = 2, but validation only runs once completedTasks >= validationWarmup; with a single task that threshold is unreachable before completion, so --validate is effectively disabled for the whole run. This allows single-task greenfield runs to finish without any test/lint/build gate.
Useful? React with 👍 / 👎.
|
Superseded by #188 — all changes consolidated into a single PR. |
Summary
Fixes loop failures when building new projects from scratch (e.g., "build a React todo app"). Three root causes addressed:
npm. Now auto-detects pnpm/yarn/bun from lockfiles andpackageManagerfield--validation-warmup)Changes
src/loop/executor.ts— Circuit breaker reset on task advancement + validation warm-up guardsrc/loop/validation.ts— Use detected package manager in fallback pathsrc/commands/init.ts— Use detected PM in project detection + AGENTS.md generationsrc/commands/run.ts— Use detected PM for dev commands + auto-detect greenfield warm-upsrc/wizard/spec-generator.ts— Use detected PM for generated validation commandssrc/cli.ts— Add--validation-warmupCLI flagsrc/utils/package-manager.ts— NEW package manager detection utilitysrc/utils/__tests__/package-manager.test.ts— NEW 13 tests for PM detectionTest plan
pnpm buildpassespnpm test:runpasses (156 tests, 13 new)--validateon a greenfield project🤖 Generated with Claude Code